package servlets;

import java.net.URL;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import main.Main;
import searcher.DocumentSearcher;
import dao.VocabularyDAO;
import domain.Vocabulary;

public class StartupServlet extends HttpServlet implements Servlet {
	private static final long serialVersionUID = 6333087112179819055L;

	@Override
	public void init() throws ServletException {
		try {
			URL path = this.getClass().getResource("/");
			Main.main(new String[]{path.toString()});
			VocabularyDAO vocabularyDAO = new VocabularyDAO();
			DocumentSearcher.setVocabularies(vocabularyDAO.select(new Vocabulary()));
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServletException(e);
		}
	}
}
